package routers

import (
	"github.com/gin-gonic/gin"
	"github.com/sirupsen/logrus"
	"muziai-server/global"
	"muziai-server/middleware"
)

func InitRouters() {
	gin.SetMode(global.Config.System.Env)

	router := gin.Default()
	router.Static("/uploads/images", "uploads/images")

	apiRouter := router.Group("api")
	//使用中间件
	apiRouter.Use(middleware.MiddlewareLog)

	SettingsRouter(apiRouter)
	UserRouter(apiRouter)
	WxRouter(apiRouter)
	AiRoleRouter(apiRouter)
	SessionRouter(apiRouter)
	ChatRouter(apiRouter)
	ImageRouter(apiRouter)
	OrderRouter(apiRouter)
	AliRouter(apiRouter)
	LogRouter(apiRouter)
	FileRouter(apiRouter)
	DataRouter(apiRouter)
	addr := global.Config.System.Addr()
	logrus.Infof("web服务运行在%s", addr)

	router.Run(addr)
}
